package com.cn.zmc.design.chian.disruptor.publish;

import com.cn.zmc.design.chian.domain.Trade;
import com.lmax.disruptor.RingBuffer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import java.util.UUID;

@Component
public class TradePublish extends AbstractPublish{


    /*@Autowired
    @Qualifier("tradeRingBuffer")
    private RingBuffer<Trade> tradeRingBuffer;*/

    @Override
    void publish() {
       /* long sequence = tradeRingBuffer.next();
        try {
            Trade trade = tradeRingBuffer.get(sequence);
            trade.setId(UUID.randomUUID().toString());
        } catch (Exception e) {

        } finally {
            tradeRingBuffer.publish(sequence);
        }*/
    }
}
